package it.eng.area118.mdocommon.android.vibration;

import android.content.Context;
import android.os.Vibrator;
import it.eng.area118.mdocommon.android.notification.AndroidNotification;
import it.eng.area118.mdocommon.android.util.AndroidApplicationContext;

public class AndroidVibration implements Vibration {

	private int dot = 200; // Length of a Morse Code "dot" in milliseconds
	private int dash = 500; // Length of a Morse Code "dash" in milliseconds
	private int short_gap = 200; // Length of Gap Between dots/dashes
	private int medium_gap = 500; // Length of Gap Between Letters
	private int long_gap = 1000; // Length of Gap Between Words
	private long[] pattern = { 0, // Start immediately
			dot, short_gap, dot, short_gap, dot, // s
			medium_gap, dash, short_gap, dash, short_gap, dash, // o
			medium_gap, dot, short_gap, dot, short_gap, dot, // s
			long_gap };

	@Override
	public void vibrate() {
		Vibrator v = (Vibrator) AndroidApplicationContext.getInstance()
				.getApplicationContext()
				.getSystemService(Context.VIBRATOR_SERVICE);
		if (v != null) {
			v.vibrate(pattern,-1);
		}

	}

}
